package com.base.commonlib.utils;

import android.content.Context;

import com.base.commonlib.base.BaseApp;
import com.base.commonlib.bean.DaoMaster;
import com.base.commonlib.bean.UserDao;
import com.base.commonlib.http.utils.ErrorLogUtil;

import org.greenrobot.greendao.database.Database;

import static com.base.commonlib.bean.DaoMaster.createAllTables;


/**
 * Created by arvin on 2018/10/8.
 */

public class MineOpenHelper extends DaoMaster.DevOpenHelper {
    public MineOpenHelper(Context context, String name) {
        super(context, name);
    }

    @Override
    public void onUpgrade(Database db, int oldVersion, int newVersion) {
        // TODO: 2018/10/8  
        createAllTables(db, true);

        try {


        }catch (Exception e)
        {
            try {
                ErrorLogUtil.saveError(BaseApp.getApp(),e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }

        if (oldVersion < newVersion) {

            MigrationHelper.getInstance().migrate(db, UserDao.class);


        }

    }
}
